package strategy;

/**策略设计模式
 * 与工厂模式不同的是 传参是对象，改变的是对象的行为
 * 而不是创建对象
 * @author weiZhiLin
 * @version 1.0
 * @date 2019/12/26 19:14
 */
public class StrategyTest {
    public static void main(String[] args) {
        StrategyDog dog = new StrategyDog();
        System.out.println("display1:");
        dog.display();
        dog.setDogBehavior(new HuskyDog());
        System.out.println("display2:");
        dog.display();
        dog.setDogBehavior(new ChaiDog());
        System.out.println("display3:");
        dog.display();
    }
}
